﻿using System;
using com.guojin.core.io;
using com.guojin.core.io.message;
using System.Collections.Generic;
using com.guojin.mj.net.message.login;

namespace com.guojin.mj.net.message.club
{
    public class ClubRoomListRet : Message
    {
        public static int TYPE = 7;
        public static int ID = 50;

        private int _roomState;  //  1代表等待   2代表游戏中  
        private string _roomId;     //6位房间号；
        private List<ClubPlayerStateChange> _roomPlayerList = new List<ClubPlayerStateChange>();
        private List<OptionEntry> _options = new List<OptionEntry>();

        public int RoomState
        {
            get
            {
                return _roomState;
            }

            set
            {
                _roomState = value;
            }
        }

        public List<ClubPlayerStateChange> RoomPlayerList
        {
            get
            {
                return _roomPlayerList;
            }
            set
            {
                _roomPlayerList = value;
            }
        }

        public List<OptionEntry> Options
        {
            get
            {
                return _options;
            }

            set
            {
                _options = value;
            }
        }

        public string RoomId
        {
            get { return _roomId; }
            set { _roomId = value; }
        }

        public void decode(Input _in)
        {
            _roomState = _in.readInt();
            RoomId = _in.readString();

            int len = _in.readInt();
            if (len > 0)
            {
                for (int i = 0; i < len; i++)
                {
                    ClubPlayerStateChange cpi = new ClubPlayerStateChange();
                    cpi.decode(_in);
                    _roomPlayerList.Add(cpi);
                }
            }

            int len2 = _in.readInt();
            if (len2  > 0)
            {
                for (int i = 0; i < len2; i++)
                {
                    OptionEntry oe = new OptionEntry();
                    oe.decode(_in);
                    _options.Add(oe);
                }
            }
        }

        public void encode(Output _out)
        {

        }

        public int getMessageId()
        {
            return ID;
        }

        public int getMessageType()
        {
            return TYPE;
        }

        public string toString()
        {
            return string.Format("roomState={0}, roomIDTex={1}, ",_roomState,RoomId);
        }
    }
}